<?php 
namespace app\api\controller;
use think\Db;
class Test extends Base{
	public function index(){
		header("Access-Control-Allow-Origin: *");
		$data['code'] = 200;
		$list = Db::table('admin_log')
				->alias('al')
				->field("al.id,al.title,al.ip,al.create_time,a.username")
				->join(['administrator'=>'a'],'al.admin_id = a.id')
				->order('id','DESC')
				->select();
		$data['data'] = $list;
		if( $this->request->isAjax() || $this->request->isPost() ){
			exit(json_encode($data));
		}else{
			return $this->fetch();
		}
	}
}